{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Terraria 1.4：为何说专家模式比大师模式困难？单人模式 Boss 血量、攻击数值的初步计算方式"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "> 创建时间：2020-06-19"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对于该文档的直观认识，可以参考下述视频：[\\[泰拉瑞亚1.4\\] 大师模式并非最困难模式？！详解旅程模式、For the Worthy、难度滑条对难度的影响](https://www.bilibili.com/video/BV1pA411i75H/)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 大致结论"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "首先，我们讨论的是 1.4.0.5 版本的游戏。很可能在以后更新的游戏版本中，下述的结论会产生变化。\n",
    "\n",
    "我们先开门见山了解一下我所理解的最困难模式为何吧：\n",
    "\n",
    "**旅程模式 2.95 倍敌怪困难度的 For the Worthy 地图**\n",
    "\n",
    "我们知道，在 Terraria 1.4 中，旅程模式下的 2.95 倍敌怪困难度并没有达到 3 倍，因此没有踏入大师模式，而仍然应称为专家模式。在这个模式下，玩家会遇到的困难有\n",
    "\n",
    "- 专家难度无法在血肉墙前获得 6 格饰品栏，以及血肉墙后获得 7 格饰品栏；\n",
    "\n",
    "- 专家难度无法获得大师模式特有物品，譬如“The Black Spot”；该物品可以较轻松地击败史莱姆女皇与光之女王等敌怪；\n",
    "\n",
    "- 专家难度 2.95 倍的 Boss 的 HP 并没有因为敌怪困难度而下降，反而是相对于大师难度 3.00 倍上升了 15.7%；\n",
    "\n",
    "- For the Worthy 本身提升了敌怪的综合性能，包括所有敌怪的 HP、ATK、防御力，以及 Boss 敌怪大小和 AI 本身；\n",
    "\n",
    "- 旅程模式下的 For the Worthy 比非旅程模式的对应情况要困难至少 2/3；这是指 HP 值与 ATK 值而言，从而容错率非常低。\n",
    "\n",
    "关于专家模式与大师模式，\n",
    "\n",
    "- 专家模式与大师模式的 AI 几乎没有区别；\n",
    "\n",
    "- 一些射弹的伤害上，2 倍难度的专家模式确实比 3 倍难度的大师模式低；但旅程模式的射弹伤害是随着难度滑条的倍数呈线性关系，即 2.95 倍难度的射弹伤害与 3 倍大师难度并没有太大区别。\n",
    "\n",
    "我们先暂且不谈非 Boss 的敌怪已经相当可怕了——开荒之初 100 点 HP 时，蓝史莱姆两次就可以将玩家踢出世界，而红色史莱姆一次即可。\n",
    "\n",
    "而对于 Boss 而言，这可能使得从世界吞噬者或克苏鲁之脑后，近乎所有 Boss 敌怪的连续两三次攻击可以让玩家直接出局。同时，Boss 的 HP 值激增，少量的 Boss 的防御值也有所增加，使得攻略 Boss 的容错率变得相当低。或许，一般来说，玩家必须要具有无伤攻略的素质，才能通关这种难度的世界。\n",
    "\n",
    "当然，这种世界也对应地有一些好处：\n",
    "\n",
    "- 旅程模式具有研究、复制功能，意味着在得到少量的花草、鱼、矿石等基础材料后，就可以无限制作物品、补药、弹药 (与金钱)；\n",
    "\n",
    "- For the Worthy 有更多更大的发光蘑菇群落，因此宝箱与生命水晶可能会相对较多且好寻找；\n",
    "\n",
    "- 2.95 倍难度的 Boss 攻击力、非 Boss 的 HP 与攻击力都比 3.00 倍小出那 0.05 倍。\n",
    "\n",
    "- 旅程模式的城镇 NPC 能力更强，且敌怪的基础被击退能力与普通模式相同。(专家与大师模式下，敌怪的基础被击退能力都得到了小幅加强)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 具体过程"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 基础数值"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "出于简化问题，我们只讨论一部分不会有第二阶段变化的 Boss 型敌怪。我们用 NPC ID 号来称呼它们。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "Map_ID_Name = {\n",
    "    13: \"世界吞噬者 (头部)\",\n",
    "    14: \"世界吞噬者 (身体)\",\n",
    "    15: \"世界吞噬者 (尾部)\",\n",
    "    266: \"克苏鲁之脑\",\n",
    "    267: \"飞眼怪\",\n",
    "    50: \"史莱姆王\",\n",
    "    113: \"血肉墙\",\n",
    "    114: \"血肉墙 (眼部)\",\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "它们的基础 HP 值、攻击力列举如下；基础值的意义是最为普通的普通模式下的数值。从下表能看出，史莱姆王的基础 HP 为 2000、攻击力为 40。从这些数值上看，史莱姆王处于世界吞噬者、克苏鲁之脑之后，蜂王之前确实是合理的。当然，由于史莱姆王的移动方式单一，使得即使 1.4 版本中史诗级地加强了史莱姆王的 AI，它也仍然是最容易攻略的 Boss。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "下述数值出自 `Terraria.NPC` 的成员函数 `void SetDefaults` 中。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "Base_HP_ATK = {\n",
    "    13:  ( 150, 22),\n",
    "    14:  ( 150, 13),\n",
    "    15:  ( 150, 11),\n",
    "    266: (1000, 30),\n",
    "    267: ( 100, 20),\n",
    "    50:  (2000, 40),\n",
    "    113: (8000, 50),\n",
    "    114: (8000, 50),\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 专家与大师模式的影响"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "我们首先定义下述类，该类能通过输入的难度倍数给出当前是否处于专家或大师难度。2.95 倍是专家难度，3 倍是大师难度。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "class GameMode:\n",
    "    \n",
    "    def __init__(self, power):\n",
    "        self.power = power\n",
    "        \n",
    "    @property\n",
    "    def isExpert(self):\n",
    "        return self.power >= 2\n",
    "    \n",
    "    @property\n",
    "    def isMaster(self):\n",
    "        return self.power >= 3"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "在 `Terraria.NPC` 的成员函数 `void ScaleStats_ApplyMultiplayerStats` 中，在专家及大师模式下对 Boss 的 HP 与 ATK 值进行了缩放。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "GameMode_HP_ATK_Scale = {\n",
    "    13:  (0.7 , 1.1),\n",
    "    14:  (0.7 , 0.8),\n",
    "    15:  (0.7 , 0.8),\n",
    "    266: (0.85, 0.9),\n",
    "    267: (0.85, 0.9),\n",
    "    50:  (0.7 , 0.8),\n",
    "    113: (0.7 , 1.5),\n",
    "    114: (0.7 , 1.5),\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "看起来大多数情况下都是削弱而非加强；但在经过上述缩放过程后，还要乘上困难倍数才得到最终的 HP 与 ATK。大师模式的困难倍数是 3 倍。\n",
    "\n",
    "但如果难度达到大师级别，Boss 的 HP 会回削弱到 0.85 倍。这也就意味着，2.95 倍的专家难度的 Boss HP 会比 3 倍的大师难度更大，且幅度是\n",
    "\n",
    "2.95 / 3 / 0.85 - 1 = 15.69%"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### For the Worthy 的影响"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "首先，在 `Terraria.NPC` 的成员函数 `void getGoodAdjustments` 中，For the Worthy 会提供一个基础 HP 与 ATK 的基础值的提升："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "GoodWorld_HP_ATK_Scale = {\n",
    "    13:  (1. , 1. ),\n",
    "    14:  (1. , 1. ),\n",
    "    15:  (1. , 1. ),\n",
    "    266: (1. , 1.2),\n",
    "    267: (1. , 1.2),\n",
    "    50:  (1. , 1. ),\n",
    "    113: (1.5, 1. ),\n",
    "    114: (1.5, 1. ),\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "可以看出，For the Worthy 并没有对许多的 Boss 的基础数值作改动；在这里被加强的 Boss 有克苏鲁之脑 (攻击力加强 20%)，以及血肉墙 (HP 加强 50%)。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "随后，在非旅程的专家模式会增加 1/2 倍，大师模式会增加 1/3 倍的 HP 与 ATK 值；旅程模式下都直接增加 1 倍的 HP 与 ATK 值。随后，ATK 值还会额外增加 1/3 倍。这是在 `Terraria.NPC` 的成员函数 `void ScaleStats_ApplyGameMode` 中实现的。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### HP 值总结"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "我们可以以下述程序来简单地计算不同的模式下，Boss 的 HP 值情况："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "def calculate_HP(idx, power, isJourneyMode, isGoodWorld):\n",
    "    HP = Base_HP_ATK[idx][0]\n",
    "    if GameMode(idx).isExpert:\n",
    "        HP *= GameMode_HP_ATK_Scale[idx][0]\n",
    "    if GameMode(power).isMaster:\n",
    "        HP *= 0.85\n",
    "    if isGoodWorld:\n",
    "        HP *= GoodWorld_HP_ATK_Scale[idx][0]\n",
    "        if not isJourneyMode:\n",
    "            HP *= (power + 1)\n",
    "        else:\n",
    "            HP *= 2 * power\n",
    "    else:\n",
    "        HP *= power\n",
    "    return int(HP)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "譬如，对于克苏鲁之脑，其在 2.95 倍难度的旅程模式 For the Worthy 下，其 HP 值为"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5015"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "calculate_HP(266, 2.95, True, True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "这个血量值已经接近通常认为最为困难的大师模式 For the Worthy 的两倍了。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "我们用下述的 pandas 表格呈现结果："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "header = pd.MultiIndex.from_product([\n",
    "    [\"普通地图\", \"For the Worthy\"],\n",
    "    [\"非旅程模式\", \"旅程模式\"],\n",
    "    [\"专家\", \"2.95\", \"大师\"]],\n",
    "    names=[\"HP 值\", \"\", \"困难度\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = np.array([[[[\n",
    "    calculate_HP(idx, power, isJourneyMode, isGoodWorld)\n",
    "    for power in (2, 2.95, 3)]\n",
    "    for isJourneyMode in (False, True)]\n",
    "    for isGoodWorld in (False, True)]\n",
    "    for idx in Map_ID_Name]\n",
    ").reshape(-1, 3 * 2 * 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th>HP 值</th>\n",
       "      <th colspan=\"6\" halign=\"left\">普通地图</th>\n",
       "      <th colspan=\"6\" halign=\"left\">For the Worthy</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th colspan=\"3\" halign=\"left\">非旅程模式</th>\n",
       "      <th colspan=\"3\" halign=\"left\">旅程模式</th>\n",
       "      <th colspan=\"3\" halign=\"left\">非旅程模式</th>\n",
       "      <th colspan=\"3\" halign=\"left\">旅程模式</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>困难度</th>\n",
       "      <th>专家</th>\n",
       "      <th>2.95</th>\n",
       "      <th>大师</th>\n",
       "      <th>专家</th>\n",
       "      <th>2.95</th>\n",
       "      <th>大师</th>\n",
       "      <th>专家</th>\n",
       "      <th>2.95</th>\n",
       "      <th>大师</th>\n",
       "      <th>专家</th>\n",
       "      <th>2.95</th>\n",
       "      <th>大师</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>世界吞噬者 (头部)</th>\n",
       "      <td>210</td>\n",
       "      <td>309</td>\n",
       "      <td>267</td>\n",
       "      <td>210</td>\n",
       "      <td>309</td>\n",
       "      <td>267</td>\n",
       "      <td>315</td>\n",
       "      <td>414</td>\n",
       "      <td>357</td>\n",
       "      <td>420</td>\n",
       "      <td>619</td>\n",
       "      <td>535</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>世界吞噬者 (身体)</th>\n",
       "      <td>210</td>\n",
       "      <td>309</td>\n",
       "      <td>267</td>\n",
       "      <td>210</td>\n",
       "      <td>309</td>\n",
       "      <td>267</td>\n",
       "      <td>315</td>\n",
       "      <td>414</td>\n",
       "      <td>357</td>\n",
       "      <td>420</td>\n",
       "      <td>619</td>\n",
       "      <td>535</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>世界吞噬者 (尾部)</th>\n",
       "      <td>210</td>\n",
       "      <td>309</td>\n",
       "      <td>267</td>\n",
       "      <td>210</td>\n",
       "      <td>309</td>\n",
       "      <td>267</td>\n",
       "      <td>315</td>\n",
       "      <td>414</td>\n",
       "      <td>357</td>\n",
       "      <td>420</td>\n",
       "      <td>619</td>\n",
       "      <td>535</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>克苏鲁之脑</th>\n",
       "      <td>1700</td>\n",
       "      <td>2507</td>\n",
       "      <td>2167</td>\n",
       "      <td>1700</td>\n",
       "      <td>2507</td>\n",
       "      <td>2167</td>\n",
       "      <td>2550</td>\n",
       "      <td>3357</td>\n",
       "      <td>2890</td>\n",
       "      <td>3400</td>\n",
       "      <td>5015</td>\n",
       "      <td>4335</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>飞眼怪</th>\n",
       "      <td>170</td>\n",
       "      <td>250</td>\n",
       "      <td>216</td>\n",
       "      <td>170</td>\n",
       "      <td>250</td>\n",
       "      <td>216</td>\n",
       "      <td>255</td>\n",
       "      <td>335</td>\n",
       "      <td>289</td>\n",
       "      <td>340</td>\n",
       "      <td>501</td>\n",
       "      <td>433</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>史莱姆王</th>\n",
       "      <td>2800</td>\n",
       "      <td>4130</td>\n",
       "      <td>3570</td>\n",
       "      <td>2800</td>\n",
       "      <td>4130</td>\n",
       "      <td>3570</td>\n",
       "      <td>4200</td>\n",
       "      <td>5530</td>\n",
       "      <td>4760</td>\n",
       "      <td>5600</td>\n",
       "      <td>8260</td>\n",
       "      <td>7140</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>血肉墙</th>\n",
       "      <td>11200</td>\n",
       "      <td>16520</td>\n",
       "      <td>14280</td>\n",
       "      <td>11200</td>\n",
       "      <td>16520</td>\n",
       "      <td>14280</td>\n",
       "      <td>25200</td>\n",
       "      <td>33180</td>\n",
       "      <td>28560</td>\n",
       "      <td>33600</td>\n",
       "      <td>49560</td>\n",
       "      <td>42840</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>血肉墙 (眼部)</th>\n",
       "      <td>11200</td>\n",
       "      <td>16520</td>\n",
       "      <td>14280</td>\n",
       "      <td>11200</td>\n",
       "      <td>16520</td>\n",
       "      <td>14280</td>\n",
       "      <td>25200</td>\n",
       "      <td>33180</td>\n",
       "      <td>28560</td>\n",
       "      <td>33600</td>\n",
       "      <td>49560</td>\n",
       "      <td>42840</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "HP 值         普通地图                                    For the Worthy         \\\n",
       "            非旅程模式                 旅程模式                        非旅程模式          \n",
       "困难度            专家   2.95     大师     专家   2.95     大师             专家   2.95   \n",
       "世界吞噬者 (头部)    210    309    267    210    309    267            315    414   \n",
       "世界吞噬者 (身体)    210    309    267    210    309    267            315    414   \n",
       "世界吞噬者 (尾部)    210    309    267    210    309    267            315    414   \n",
       "克苏鲁之脑        1700   2507   2167   1700   2507   2167           2550   3357   \n",
       "飞眼怪           170    250    216    170    250    216            255    335   \n",
       "史莱姆王         2800   4130   3570   2800   4130   3570           4200   5530   \n",
       "血肉墙         11200  16520  14280  11200  16520  14280          25200  33180   \n",
       "血肉墙 (眼部)    11200  16520  14280  11200  16520  14280          25200  33180   \n",
       "\n",
       "HP 值                                    \n",
       "                    旅程模式                \n",
       "困难度            大师     专家   2.95     大师  \n",
       "世界吞噬者 (头部)    357    420    619    535  \n",
       "世界吞噬者 (身体)    357    420    619    535  \n",
       "世界吞噬者 (尾部)    357    420    619    535  \n",
       "克苏鲁之脑        2890   3400   5015   4335  \n",
       "飞眼怪           289    340    501    433  \n",
       "史莱姆王         4760   5600   8260   7140  \n",
       "血肉墙         28560  33600  49560  42840  \n",
       "血肉墙 (眼部)    28560  33600  49560  42840  "
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame(data, index=[val for val in Map_ID_Name.values()], columns=header)\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### ATK 值总结"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "我们可以以下述程序来简单地计算不同的模式下，Boss 的 ATK 值情况："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "def calculate_ATK(idx, power, isJourneyMode, isGoodWorld):\n",
    "    ATK = Base_HP_ATK[idx][1]\n",
    "    if GameMode(idx).isExpert:\n",
    "        ATK *= GameMode_HP_ATK_Scale[idx][1]\n",
    "    if isGoodWorld:\n",
    "        ATK *= GoodWorld_HP_ATK_Scale[idx][1]\n",
    "        if not isJourneyMode:\n",
    "            ATK *= (power + 1)\n",
    "        else:\n",
    "            ATK *= 2 * power\n",
    "        ATK *= 4/3\n",
    "    else:\n",
    "        ATK *= power\n",
    "    return int(ATK)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "譬如，对于血肉墙，其在 2.95 倍难度的旅程模式 For the Worthy 下，其 ATK 值为"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "590"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "calculate_ATK(113, 2.95, True, True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "这也就意味着，不论玩家防御力多高，如果只有血肉墙前的装备，在其贴身一击下，是不可能活下来的。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "我们用下述的 pandas 表格呈现结果："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "header = pd.MultiIndex.from_product([\n",
    "    [\"普通地图\", \"For the Worthy\"],\n",
    "    [\"非旅程模式\", \"旅程模式\"],\n",
    "    [\"专家\", \"2.95\", \"大师\"]],\n",
    "    names=[\"ATK 值\", \"\", \"困难度\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = np.array([[[[\n",
    "    calculate_ATK(idx, power, isJourneyMode, isGoodWorld)\n",
    "    for power in (2, 2.95, 3)]\n",
    "    for isJourneyMode in (False, True)]\n",
    "    for isGoodWorld in (False, True)]\n",
    "    for idx in Map_ID_Name]\n",
    ").reshape(-1, 3 * 2 * 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th>ATK 值</th>\n",
       "      <th colspan=\"6\" halign=\"left\">普通地图</th>\n",
       "      <th colspan=\"6\" halign=\"left\">For the Worthy</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th colspan=\"3\" halign=\"left\">非旅程模式</th>\n",
       "      <th colspan=\"3\" halign=\"left\">旅程模式</th>\n",
       "      <th colspan=\"3\" halign=\"left\">非旅程模式</th>\n",
       "      <th colspan=\"3\" halign=\"left\">旅程模式</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>困难度</th>\n",
       "      <th>专家</th>\n",
       "      <th>2.95</th>\n",
       "      <th>大师</th>\n",
       "      <th>专家</th>\n",
       "      <th>2.95</th>\n",
       "      <th>大师</th>\n",
       "      <th>专家</th>\n",
       "      <th>2.95</th>\n",
       "      <th>大师</th>\n",
       "      <th>专家</th>\n",
       "      <th>2.95</th>\n",
       "      <th>大师</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>世界吞噬者 (头部)</th>\n",
       "      <td>48</td>\n",
       "      <td>71</td>\n",
       "      <td>72</td>\n",
       "      <td>48</td>\n",
       "      <td>71</td>\n",
       "      <td>72</td>\n",
       "      <td>96</td>\n",
       "      <td>127</td>\n",
       "      <td>129</td>\n",
       "      <td>129</td>\n",
       "      <td>190</td>\n",
       "      <td>193</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>世界吞噬者 (身体)</th>\n",
       "      <td>20</td>\n",
       "      <td>30</td>\n",
       "      <td>31</td>\n",
       "      <td>20</td>\n",
       "      <td>30</td>\n",
       "      <td>31</td>\n",
       "      <td>41</td>\n",
       "      <td>54</td>\n",
       "      <td>55</td>\n",
       "      <td>55</td>\n",
       "      <td>81</td>\n",
       "      <td>83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>世界吞噬者 (尾部)</th>\n",
       "      <td>17</td>\n",
       "      <td>25</td>\n",
       "      <td>26</td>\n",
       "      <td>17</td>\n",
       "      <td>25</td>\n",
       "      <td>26</td>\n",
       "      <td>35</td>\n",
       "      <td>46</td>\n",
       "      <td>46</td>\n",
       "      <td>46</td>\n",
       "      <td>69</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>克苏鲁之脑</th>\n",
       "      <td>54</td>\n",
       "      <td>79</td>\n",
       "      <td>81</td>\n",
       "      <td>54</td>\n",
       "      <td>79</td>\n",
       "      <td>81</td>\n",
       "      <td>129</td>\n",
       "      <td>170</td>\n",
       "      <td>172</td>\n",
       "      <td>172</td>\n",
       "      <td>254</td>\n",
       "      <td>259</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>飞眼怪</th>\n",
       "      <td>36</td>\n",
       "      <td>53</td>\n",
       "      <td>54</td>\n",
       "      <td>36</td>\n",
       "      <td>53</td>\n",
       "      <td>54</td>\n",
       "      <td>86</td>\n",
       "      <td>113</td>\n",
       "      <td>115</td>\n",
       "      <td>115</td>\n",
       "      <td>169</td>\n",
       "      <td>172</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>史莱姆王</th>\n",
       "      <td>64</td>\n",
       "      <td>94</td>\n",
       "      <td>96</td>\n",
       "      <td>64</td>\n",
       "      <td>94</td>\n",
       "      <td>96</td>\n",
       "      <td>128</td>\n",
       "      <td>168</td>\n",
       "      <td>170</td>\n",
       "      <td>170</td>\n",
       "      <td>251</td>\n",
       "      <td>256</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>血肉墙</th>\n",
       "      <td>150</td>\n",
       "      <td>221</td>\n",
       "      <td>225</td>\n",
       "      <td>150</td>\n",
       "      <td>221</td>\n",
       "      <td>225</td>\n",
       "      <td>300</td>\n",
       "      <td>395</td>\n",
       "      <td>400</td>\n",
       "      <td>400</td>\n",
       "      <td>590</td>\n",
       "      <td>600</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>血肉墙 (眼部)</th>\n",
       "      <td>150</td>\n",
       "      <td>221</td>\n",
       "      <td>225</td>\n",
       "      <td>150</td>\n",
       "      <td>221</td>\n",
       "      <td>225</td>\n",
       "      <td>300</td>\n",
       "      <td>395</td>\n",
       "      <td>400</td>\n",
       "      <td>400</td>\n",
       "      <td>590</td>\n",
       "      <td>600</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "ATK 值       普通地图                          For the Worthy                      \\\n",
       "           非旅程模式           旅程模式                    非旅程模式           旅程模式        \n",
       "困难度           专家 2.95   大师   专家 2.95   大师             专家 2.95   大师   专家 2.95   \n",
       "世界吞噬者 (头部)    48   71   72   48   71   72             96  127  129  129  190   \n",
       "世界吞噬者 (身体)    20   30   31   20   30   31             41   54   55   55   81   \n",
       "世界吞噬者 (尾部)    17   25   26   17   25   26             35   46   46   46   69   \n",
       "克苏鲁之脑         54   79   81   54   79   81            129  170  172  172  254   \n",
       "飞眼怪           36   53   54   36   53   54             86  113  115  115  169   \n",
       "史莱姆王          64   94   96   64   94   96            128  168  170  170  251   \n",
       "血肉墙          150  221  225  150  221  225            300  395  400  400  590   \n",
       "血肉墙 (眼部)     150  221  225  150  221  225            300  395  400  400  590   \n",
       "\n",
       "ATK 值            \n",
       "                 \n",
       "困难度          大师  \n",
       "世界吞噬者 (头部)  193  \n",
       "世界吞噬者 (身体)   83  \n",
       "世界吞噬者 (尾部)   70  \n",
       "克苏鲁之脑       259  \n",
       "飞眼怪         172  \n",
       "史莱姆王        256  \n",
       "血肉墙         600  \n",
       "血肉墙 (眼部)    600  "
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame(data, index=[val for val in Map_ID_Name.values()], columns=header)\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 补充信息"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "上述程序信息来自 [ILSpy](https://github.com/icsharpcode/ILSpy) 对 Terraria 1.4.0.5 的反向工程结果。"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
